{% load static %}
{% load manager_attachment_tags %}
<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="renderer" content="webkit">
    <title>附件选择</title>
    <link rel="stylesheet" href="{% static '/public/css/ui.css' %}">
    <link rel="stylesheet" href="{% static '/public/admin/css/layout.css' %}">
    <script src="{% static '/public/js/jquery.js' %}"></script>
    <script src="{% static '/public/js/ui.js' %}"></script>
    <script src="{% static '/public/admin/js/base.js' %}"></script>
</head>
<body class="ui-p-10">

<div class="ui-tabs ui-tabs-white" data-href="1">
	<ul class="ui-tabs-nav">
	  <li class="active"><a href="/manager/upload/imagelist/?type={{type}}&multiple={{multiple}}&gid=0&iseditor={{iseditor}}&islocal={{islocal}}&thumb={{thumb}}&water={{water}}">附件选择</a></li>
	  <li><a href="/manager/upload/imageupload/?type={{type}}&multiple={{multiple}}&gid={{gid}}&iseditor={{iseditor}}&islocal={{islocal}}&thumb={{thumb}}&water={{water}}">本地上传</a></li>
	</ul>
	<div class="ui-tabs-content">
		<div class="ui-tabs-pane active">
			<!--loop-->
			<div class="ui-tabs" data-href="1" style="margin-top:-10px;">
				<div class="ui-tabs-header-nav">
					<ul class="ui-tabs-nav">
						<li class="active"><a href="/manager/upload/imagelist?multiple={{multiple}}&type={{type}}&iseditor={{iseditor}}&islocal={{islocal}}&gid=-1&thumb={{thumb}}&water={{water}}">附件选择</a></li>
					</ul>
					<div class="ui-tabs-header-more">
                    	<form action="/manager/upload/imagelist/?type={{type}}&multiple={{multiple}}&gid={{gid}}&iseditor={{iseditor}}&islocal={{islocal}}&thumb={{thumb}}&water={{water}}">
                    	<div class="ui-form-group">
                            <div class="ui-input-group">
                                <input type="text" name="keyword" value="{{keyword}}" class="ui-form-ip radius-right-none" placeholder="请输入关键字" style="min-width:200px;">
                                <button type="submit" class="after"><div class="ui-icon-search"></div></button>
                            </div>
                        </div>
                        </form>
                    </div>
				</div>
				
			</div>
			{% attachment_list %}
			
			<input type="hidden" id="piclist">
			<!--loop-->
		</div>
	</div>
</div>
<script>
$(function()
{
	$(document).on("click","#list .ui-piclist-item",function()
	{
		var val=$(this).data("url");
		{% if multiple == 0 %}
		$("#list .ui-piclist-item").each(function()
		{
			$(this).removeClass("hover");
		})
		{% endif %}
		$(this).toggleClass("hover");
		choose();
	});
});
function choose()
{
	var str='';
	$("#list .ui-piclist-item").each(function(){
		var val=$(this).data("url");
		if($(this).hasClass("hover"))
		{
			if(str!='')
			{
				str=str+'|';
			}
			str=str+val;
		}
	})
	$('#piclist').val(str);
}
</script>
</body>
</html>